<?php

namespace app\common\model\mysql;

use think\Model;

class SpecsValue extends Model
{
    public function getBySpecsId($where)
    {
        $where['status'] = config("status.mysql.table_normal");
        $res =  $this->where($where)->select();
//        echo $this->getLastSql();
        return $res;
    }

    public function getNamesBySpecsId($specsId)
    {
        $where = [
            'specs_id' => $specsId,
        ];
        $res = $this->where($where)->field('name')->select();
        return $res->toArray();
    }

    public function updateByStatus($id, $status)
    {
        $data = [
            'id' => $id,
            'status' => $status,
        ];
        $res = $this->where($data)->save();
        return $res;
    }
}